package o;

import com.huawei.appgallery.agwebview.controlmore.db.WapControlMore;
import com.huawei.appgallery.agwebview.whitelist.bean.DomainWhiteListResponse.ControlMore;
import java.util.ArrayList;
import java.util.List;

public class bak {
    private static bak ˏ = null;
    public static final String ॱ = WapControlMore.class.getSimpleName();

    private bak() {
    }

    public static synchronized bak ˊ() {
        bak o_bak;
        synchronized (bak.class) {
            if (ˏ == null) {
                ˏ = new bak();
            }
            o_bak = ˏ;
        }
        return o_bak;
    }

    public void ˋ(List<ControlMore> list) {
        if (list != null && list.size() != 0) {
            List arrayList = new ArrayList();
            List arrayList2 = new ArrayList();
            for (ControlMore controlMore : list) {
                if (!dof.ˋ(controlMore.ˊ())) {
                    if (1 == controlMore.ˏ()) {
                        arrayList.add(controlMore);
                    } else if (controlMore.ˏ() == 0) {
                        arrayList2.add(controlMore);
                    }
                }
            }
            if (arrayList.size() > 0) {
                ˊ(arrayList);
            }
            if (arrayList2.size() > 0) {
                ˏ(arrayList2);
            }
        }
    }

    private void ˊ(List<ControlMore> list) {
        List arrayList = new ArrayList();
        List arrayList2 = new ArrayList();
        List arrayList3 = new ArrayList();
        String str = "urlPath_=?";
        for (ControlMore controlMore : list) {
            WapControlMore wapControlMore = new WapControlMore();
            wapControlMore.ˎ(controlMore.ˊ());
            wapControlMore.ˏ(controlMore.ˎ() == null ? "" : controlMore.ˎ());
            wapControlMore.ˊ(controlMore.ॱ() == null ? "" : controlMore.ॱ());
            arrayList.add(wapControlMore);
            arrayList2.add(str);
            arrayList3.add(new String[]{controlMore.ˊ()});
        }
        euc.ˊ().ˊ(ॱ, arrayList, arrayList2, arrayList3);
    }

    private void ˏ(List<ControlMore> list) {
        for (ControlMore controlMore : list) {
            if (euc.ˊ().ॱ(ॱ, "urlPath_=?", new String[]{controlMore.ˊ()}) == 0) {
                azh.ˏ.ˏ("WapControlMoreDAO", "delete error.");
            }
        }
    }

    /* JADX WARNING: inconsistent code. */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public com.huawei.appgallery.agwebview.controlmore.db.WapControlMore ˏ(java.lang.String r8) {
        /*
        r7 = this;
        r6 = 0;
        r0 = o.dof.ˋ(r8);
        if (r0 == 0) goto L_0x0009;
    L_0x0007:
        r0 = r6;
    L_0x0008:
        return r0;
    L_0x0009:
        r0 = o.euc.ˊ();	 Catch:{ Exception -> 0x007c, all -> 0x0098 }
        r1 = ॱ;	 Catch:{ Exception -> 0x007c, all -> 0x0098 }
        r2 = 3;
        r2 = new java.lang.String[r2];	 Catch:{ Exception -> 0x007c, all -> 0x0098 }
        r3 = 0;
        r4 = "urlPath_";
        r2[r3] = r4;	 Catch:{ Exception -> 0x007c, all -> 0x0098 }
        r3 = 1;
        r4 = "controlLeft_";
        r2[r3] = r4;	 Catch:{ Exception -> 0x007c, all -> 0x0098 }
        r3 = 2;
        r4 = "controlRight_";
        r2[r3] = r4;	 Catch:{ Exception -> 0x007c, all -> 0x0098 }
        r3 = 0;
        r4 = 0;
        r5 = "length(urlPath_) DESC";
        r1 = r0.ˏ(r1, r2, r3, r4, r5);	 Catch:{ Exception -> 0x007c, all -> 0x0098 }
        if (r1 == 0) goto L_0x007a;
    L_0x002b:
        r0 = r1.moveToFirst();	 Catch:{ Exception -> 0x00b0, all -> 0x00ab }
        if (r0 == 0) goto L_0x007a;
    L_0x0031:
        r0 = "urlPath_";
        r0 = r1.getColumnIndex(r0);	 Catch:{ Exception -> 0x00b0, all -> 0x00ab }
        r0 = r1.getString(r0);	 Catch:{ Exception -> 0x00b0, all -> 0x00ab }
        r0 = o.bbd.ˏ(r8, r0);	 Catch:{ Exception -> 0x00b0, all -> 0x00ab }
        if (r0 == 0) goto L_0x0074;
    L_0x0041:
        r0 = "controlLeft_";
        r0 = r1.getColumnIndex(r0);	 Catch:{ Exception -> 0x00b0, all -> 0x00ab }
        r2 = r1.getString(r0);	 Catch:{ Exception -> 0x00b0, all -> 0x00ab }
        r0 = "controlRight_";
        r0 = r1.getColumnIndex(r0);	 Catch:{ Exception -> 0x00b0, all -> 0x00ab }
        r3 = r1.getString(r0);	 Catch:{ Exception -> 0x00b0, all -> 0x00ab }
        r0 = new com.huawei.appgallery.agwebview.controlmore.db.WapControlMore;	 Catch:{ Exception -> 0x00b0, all -> 0x00ab }
        r0.<init>();	 Catch:{ Exception -> 0x00b0, all -> 0x00ab }
        r0.ˎ(r8);	 Catch:{ Exception -> 0x00b4, all -> 0x00ab }
        r0.ˏ(r2);	 Catch:{ Exception -> 0x00b4, all -> 0x00ab }
        r0.ˊ(r3);	 Catch:{ Exception -> 0x00b4, all -> 0x00ab }
    L_0x0063:
        if (r1 == 0) goto L_0x0008;
    L_0x0065:
        r1.close();	 Catch:{ Exception -> 0x0069 }
        goto L_0x0008;
    L_0x0069:
        r1 = move-exception;
        r1 = o.azh.ˏ;
        r2 = "WapControlMoreDAO";
        r3 = "close error.";
        r1.ˏ(r2, r3);
        goto L_0x0008;
    L_0x0074:
        r0 = r1.moveToNext();	 Catch:{ Exception -> 0x00b0, all -> 0x00ab }
        if (r0 != 0) goto L_0x0031;
    L_0x007a:
        r0 = r6;
        goto L_0x0063;
    L_0x007c:
        r0 = move-exception;
        r0 = r6;
    L_0x007e:
        r1 = "WapControlMoreDAO";
        r2 = "query error";
        o.dna.ˎ(r1, r2);	 Catch:{ all -> 0x00ad }
        if (r6 == 0) goto L_0x0008;
    L_0x0087:
        r6.close();	 Catch:{ Exception -> 0x008c }
        goto L_0x0008;
    L_0x008c:
        r1 = move-exception;
        r1 = o.azh.ˏ;
        r2 = "WapControlMoreDAO";
        r3 = "close error.";
        r1.ˏ(r2, r3);
        goto L_0x0008;
    L_0x0098:
        r0 = move-exception;
        r1 = r6;
    L_0x009a:
        if (r1 == 0) goto L_0x009f;
    L_0x009c:
        r1.close();	 Catch:{ Exception -> 0x00a0 }
    L_0x009f:
        throw r0;
    L_0x00a0:
        r1 = move-exception;
        r1 = o.azh.ˏ;
        r2 = "WapControlMoreDAO";
        r3 = "close error.";
        r1.ˏ(r2, r3);
        goto L_0x009f;
    L_0x00ab:
        r0 = move-exception;
        goto L_0x009a;
    L_0x00ad:
        r0 = move-exception;
        r1 = r6;
        goto L_0x009a;
    L_0x00b0:
        r0 = move-exception;
        r0 = r6;
        r6 = r1;
        goto L_0x007e;
    L_0x00b4:
        r2 = move-exception;
        r6 = r1;
        goto L_0x007e;
        */
        throw new UnsupportedOperationException("Method not decompiled: o.bak.ˏ(java.lang.String):com.huawei.appgallery.agwebview.controlmore.db.WapControlMore");
    }
}
